# -*- coding: utf-8 -*- 
"""
PyFem - Finite element software.
Raul Durand & Dorival Pedroso
Copyright 2010-2013.
"""

from pyfem.tools.matvec import *
from numpy import array

# ALL 1
ALL_IP1 = array([[  0.0, 0.0, 0.0, 1.0 ]])

# LIN 2
LIN_IP2 = array([\
[  -0.577350269189625764509149, 0.0, 0.0, 1.0 ],
[   0.577350269189625764509149, 0.0, 0.0, 1.0 ]])

# LIN 3
LIN_IP3 = array([\
[ -0.774596669241483377035835, 0.0, 0.0, 0.555555555555555555555556  ],
[  0.000000000000000000000000, 0.0, 0.0, 0.888888888888888888888889  ],
[  0.774596669241483377035835, 0.0, 0.0, 0.555555555555555555555556  ]])

# LIN_IP4
LIN_IP4 = array([\
[ -0.861136311594052575223946, 0.0, 0.0, 0.34785484513745385737306 ],
[ -0.339981043584856264802666, 0.0, 0.0, 0.65214515486254614262694 ],
[  0.339981043584856264802666, 0.0, 0.0, 0.65214515486254614262694 ],
[  0.861136311594052575223946, 0.0, 0.0, 0.34785484513745385737306 ]])

# TRI_IP1
TRI_IP1 = array([[  1.0/3.0,  1.0/3.0,  0.0,  1.0/2.0 ]])

# TRI_IP3
TRI_IP3 = array([\
[  1.0/6.0,   1.0/6.0,   0.0,   1.0/6.0 ],
[  2.0/3.0,   1.0/6.0,   0.0,   1.0/6.0 ],
[  1.0/6.0,   2.0/3.0,   0.0,   1.0/6.0 ]])

# TRI_IP4
TRI_IP4 = array([\
[ 1.0/3.0,   1.0/3.0,   0.0,   -27.0/96.0 ],
[ 1.0/5.0,   1.0/5.0,   0.0,    25.0/96.0 ],
[ 3.0/5.0,   1.0/5.0,   0.0,    25.0/96.0 ],
[ 1.0/5.0,   3.0/5.0,   0.0,    25.0/96.0 ]])

# TRI_IP6
TRI_IP6 = array([\
[   0.091576213509771,   0.091576213509771,    0.0,    0.109951743655322/2.0 ],
[   0.816847572980459,   0.091576213509771,    0.0,    0.109951743655322/2.0 ],
[   0.091576213509771,   0.816847572980459,    0.0,    0.109951743655322/2.0 ],
[   0.445948490915965,   0.445948490915965,    0.0,    0.223381589678011/2.0 ],
[   0.108103018168070,   0.445948490915965,    0.0,    0.223381589678011/2.0 ],
[   0.445948490915965,   0.108103018168070,    0.0,    0.223381589678011/2.0 ]])

# QUAD 1x1
QUAD_IP1 = array([\
[     0.000000000000000,     0.000000000000000,     0.0,     4.0 ]])

# QUAD 2x2
QUAD_IP2 = array([\
[    -0.577350269189626,    -0.577350269189626,     0.0,     1.0  ],
[     0.577350269189626,    -0.577350269189626,     0.0,     1.0  ],
[    -0.577350269189626,     0.577350269189626,     0.0,     1.0  ],
[     0.577350269189626,     0.577350269189626,     0.0,     1.0 ]])

# QUAD 3x3
__02r15 = 0.2*15.0**0.5
__25d81 = 25.0/81.0
__40d81 = 40.0/81.0
__64d81 = 64.0/81.0
QUAD_IP3 =  array([\
[  -__02r15 , -__02r15 , 0.0 , __25d81 ],
[       0.0 , -__02r15 , 0.0 , __40d81 ],
[   __02r15 , -__02r15 , 0.0 , __25d81 ],
[  -__02r15 ,      0.0 , 0.0 , __40d81 ],
[       0.0 ,      0.0 , 0.0 , __64d81 ],
[   __02r15 ,      0.0 , 0.0 , __40d81 ],
[  -__02r15 ,  __02r15 , 0.0 , __25d81 ],
[       0.0 ,  __02r15 , 0.0 , __40d81 ],
[   __02r15 ,  __02r15 , 0.0 , __25d81 ]])


# QUAD 4x4
QUAD_IP4 = array([\
[   -0.861136311594053,    -0.861136311594053,     0.0,     0.121002993285602 ],
[   -0.339981043584856,    -0.861136311594053,     0.0,     0.226851851851852 ],
[    0.339981043584856,    -0.861136311594053,     0.0,     0.226851851851852 ],
[    0.861136311594053,    -0.861136311594053,     0.0,     0.121002993285602 ],
[   -0.861136311594053,    -0.339981043584856,     0.0,     0.226851851851852 ],
[   -0.339981043584856,    -0.339981043584856,     0.0,     0.425293303010694 ],
[    0.339981043584856,    -0.339981043584856,     0.0,     0.425293303010694 ],
[    0.861136311594053,    -0.339981043584856,     0.0,     0.226851851851852 ],
[   -0.861136311594053,     0.339981043584856,     0.0,     0.226851851851852 ],
[   -0.339981043584856,     0.339981043584856,     0.0,     0.425293303010694 ],
[    0.339981043584856,     0.339981043584856,     0.0,     0.425293303010694 ],
[    0.861136311594053,     0.339981043584856,     0.0,     0.226851851851852 ],
[   -0.861136311594053,     0.861136311594053,     0.0,     0.121002993285602 ],
[   -0.339981043584856,     0.861136311594053,     0.0,     0.226851851851852 ],
[    0.339981043584856,     0.861136311594053,     0.0,     0.226851851851852 ],
[    0.861136311594053,     0.861136311594053,     0.0,     0.121002993285602 ]])


# TET_IP1
TET_IP1 = array([\
[    1./4.,   1./4.,   1./4.,   1./6.  ]])


# TET_IP4
TET_IP4 = array([
[  0.5854101966249685, 0.1381966011250105, 0.1381966011250105, 0.04166666666666667 ],
[  0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.04166666666666667 ],
[  0.1381966011250105, 0.1381966011250105, 0.5854101966249685, 0.04166666666666667 ],
[  0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.04166666666666667 ]])


# TET_IP5 (Peter Wriggers)
TET_IP5 = array([\
[  1./4.,   1./4.,   1./4.,   -2./15. ],
[  1./6.,   1./6.,   1./6.,    3./40. ],
[  1./6.,   1./6.,   1./2.,    3./40. ],
[  1./6.,   1./2.,   1./6.,    3./40. ],
[  1./2.,   1./6.,   1./6.,    3./40. ]] )


# TET_IP11
__1pr_15d14_d4 = (1. + (5./14.)**0.5)/4.
__1mr_15d14_d4 = (1. - (5./14.)**0.5)/4.
#[  a = ( 1 + √ (5/14) )  / 4 = 0. 3994035761667992
#[  b = ( 1 − √ (5/14) )  / 4 = 0. 1005964238332008
TET_IP11 = array([\
[          1./4. ,             1./4. ,            1./4. ,   -74./5625.  ],
[         11./14.,             1./14.,            1./14.,   343./45000. ],
[          1./14.,            11./14.,            1./14.,   343./45000. ],
[          1./14.,             1./14.,           11./14.,   343./45000. ],
[          1./14.,             1./14.,            1./14.,   343./45000. ],
[  __1pr_15d14_d4,     __1pr_15d14_d4,    __1mr_15d14_d4,    56./2250.  ],
[  __1pr_15d14_d4,     __1mr_15d14_d4,    __1pr_15d14_d4,    56./2250.  ],
[  __1pr_15d14_d4,     __1mr_15d14_d4,    __1mr_15d14_d4,    56./2250.  ],
[  __1mr_15d14_d4,     __1pr_15d14_d4,    __1pr_15d14_d4,    56./2250.  ],
[  __1mr_15d14_d4,     __1pr_15d14_d4,    __1mr_15d14_d4,    56./2250.  ],
[  __1mr_15d14_d4,     __1mr_15d14_d4,    __1pr_15d14_d4,    56./2250.  ]])


# HEX 2x2x2
HEX_IP2 = array([\
[    -0.577350269189626,    -0.577350269189626,    -0.577350269189626,     1.000000000000000  ],
[     0.577350269189626,    -0.577350269189626,    -0.577350269189626,     1.000000000000000  ],
[    -0.577350269189626,     0.577350269189626,    -0.577350269189626,     1.000000000000000  ],
[     0.577350269189626,     0.577350269189626,    -0.577350269189626,     1.000000000000000  ],
[    -0.577350269189626,    -0.577350269189626,     0.577350269189626,     1.000000000000000  ],
[     0.577350269189626,    -0.577350269189626,     0.577350269189626,     1.000000000000000  ],
[    -0.577350269189626,     0.577350269189626,     0.577350269189626,     1.000000000000000  ],
[     0.577350269189626,     0.577350269189626,     0.577350269189626,     1.000000000000000  ]])


# HEX 3x3x3
HEX_IP3 = array([\
[   -0.774596669241483,    -0.774596669241483,    -0.774596669241483,     0.171467764060357  ],
[    0.000000000000000,    -0.774596669241483,    -0.774596669241483,     0.274348422496571  ],
[    0.774596669241483,    -0.774596669241483,    -0.774596669241483,     0.171467764060357  ],
[   -0.774596669241483,     0.000000000000000,    -0.774596669241483,     0.274348422496571  ],
[    0.000000000000000,     0.000000000000000,    -0.774596669241483,     0.438957475994513  ],
[    0.774596669241483,     0.000000000000000,    -0.774596669241483,     0.274348422496571  ],
[   -0.774596669241483,     0.774596669241483,    -0.774596669241483,     0.171467764060357  ],
[    0.000000000000000,     0.774596669241483,    -0.774596669241483,     0.274348422496571  ],
[    0.774596669241483,     0.774596669241483,    -0.774596669241483,     0.171467764060357  ],
[   -0.774596669241483,    -0.774596669241483,     0.000000000000000,     0.274348422496571  ],
[    0.000000000000000,    -0.774596669241483,     0.000000000000000,     0.438957475994513  ],
[    0.774596669241483,    -0.774596669241483,     0.000000000000000,     0.274348422496571  ],
[   -0.774596669241483,     0.000000000000000,     0.000000000000000,     0.438957475994513  ],
[    0.000000000000000,     0.000000000000000,     0.000000000000000,     0.702331961591221  ],
[    0.774596669241483,     0.000000000000000,     0.000000000000000,     0.438957475994513  ],
[   -0.774596669241483,     0.774596669241483,     0.000000000000000,     0.274348422496571  ],
[    0.000000000000000,     0.774596669241483,     0.000000000000000,     0.438957475994513  ],
[    0.774596669241483,     0.774596669241483,     0.000000000000000,     0.274348422496571  ],
[   -0.774596669241483,    -0.774596669241483,     0.774596669241483,     0.171467764060357  ],
[    0.000000000000000,    -0.774596669241483,     0.774596669241483,     0.274348422496571  ],
[    0.774596669241483,    -0.774596669241483,     0.774596669241483,     0.171467764060357  ],
[   -0.774596669241483,     0.000000000000000,     0.774596669241483,     0.274348422496571  ],
[    0.000000000000000,     0.000000000000000,     0.774596669241483,     0.438957475994513  ],
[    0.774596669241483,     0.000000000000000,     0.774596669241483,     0.274348422496571  ],
[   -0.774596669241483,     0.774596669241483,     0.774596669241483,     0.171467764060357  ],
[    0.000000000000000,     0.774596669241483,     0.774596669241483,     0.274348422496571  ],
[    0.774596669241483,     0.774596669241483,     0.774596669241483,     0.171467764060357  ]])

